C
C   *** LAST REVISED ON 17-JUL-1985 08:16:14.61
C   *** SOURCE FILE: [LONG.GRAPHICS.LONGLIB]SUBPROC.FOR
C
C *********************************************************************
C
C	SUBPROCESS CREATION SUBROUTINES
C
C	NOTE: LOCATION OF THE DCL COMMAND FILES FOR PROCESSING
C	THE PRINTER FILE DATA IS SPECIFIED IN THE SOURCE CODE USING
C	THE LOGICAL NAME LONGLOC.  THIS MUST BE DEFINED PRIOR TO USING
C	THESE ROUTINES.
C
C *********************************************************************
C
	SUBROUTINE PSUBPRO(I,IFLAG,IPRINT)
C
C      CREATE A SUBPROCESS TO RUN RASTERSCAN CONVERTER PROGRAM
C
C	I	(I)	RASTER SCAN CONVERSION PROGRAM TYPE
C			= 0 PRINTRONIX PRINTER (DEFAULT)
C			= 1 LOW RES TRILOG PRINTER
C			= 2 HI RES TRILOG PRINTER
C	IFLAG	(I)	CONCURRENT PROCESS OPTION
C			= 0 WAIT FOR COMPLETION
C			= 1 NO WAIT
C	IPRINT	(I)	PRINT FLAG
C			= 0 DO NOT PRINT (DEFAULT)
C			= 1 PRINT
C
	CHARACTER*50 INPUT
	CHARACTER*10 OUTPUT
	GOTO (1,2,3) I+1 
  1   	INPUT = 'LONGLOC:NPLOT183.COM'
	IF (IPRINT.EQ.1) 
     $	  INPUT = 'LONGLOC:PLOT183.COM'
      	GOTO 4
  2   	INPUT = 'LONGLOC:NPLOTLO.COM'
	IF (IPRINT.EQ.1) 
     $	  INPUT = 'LONGLOC:PLOTLO.COM'
      	GOTO 4
  3   	INPUT = 'LONGLOC:NPLOTHI.COM'
	IF (IPRINT.EQ.1) 
     $	  INPUT = 'LONGLOC:PLOTHI.COM'
      	GOTO 4
  4	OUTPUT = 'PLOT.LOG'
    	CALL SUBPROC(INPUT,OUTPUT,IFLAG)
  	RETURN
  	END
C
	SUBROUTINE SUBPROC(INPUT,OUTPUT,IFLAG)
C
C	Create subprocess
C	IFLAG	(I)	CONCURRENT PROCESS OPTION
C			= 0	WAIT FOR COMPLETION
C			= 1	NO WAIT
C
	CHARACTER*(*) INPUT,OUTPUT
	INTEGER CODE,LIB$SPAWN,OUTLEN,INLEN
	IFLG=IFLAG
	IF (IFLG.NE.0.AND.IFLG.NE.1) IFLG=0
	OUTLEN = INDEX(OUTPUT,' ') - 1
	INLEN = INDEX(INPUT,' ') - 1
	CODE = LIB$SPAWN(,INPUT(1:INLEN),
     $		OUTPUT(1:OUTLEN),IFLG)
	IF(.NOT.CODE) CALL LIB$SIGNAL(%VAL(CODE))
	RETURN
	END
